<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
  #mdiv{
    width:90px;
    height:90px;
    background:#0000ff;
    position:absolute;
  }
  </style>
  <script>
    var mdiv;
    window.onload=function(){
        mdiv = document.getElementById('mdiv');
    }
    function move(){
        mdiv.style.left = parseInt(mdiv.style.left)+1+'px';
        mdiv.style.top = parseInt(mdiv.style.top)+1+'px';
        setTimeout(move,10);
    }
  </script>
 </head>
 <body>
  <input type='button' value='开始移动' onclick="move()"/>
  <div id='mdiv' style='left:120px;top:90px;'></div>
 </body>
</html>

